import bus from '@/bus'
let data = {
  status: 'pass',
  columns: [{
    title: '服务分类名称',
    key: 'name',
    align: 'left'
  }, {
    title: '类型',
    key: 'serverType',
    align: 'left',
    render: (h, params) => {
      let row = params.row
      let text = row.serverType
      let x
      switch (text)
      {
      case 'SERVER_VISIT':
        x = '上门服务'
        break
      case 'STORE':
        x = '到店服务'
        break
      }
      return h('div', x)
    }
  }, {
    title: '排序',
    key: 'orderNum',
    align: 'left'
  }, {
    title: '状态',
    align: 'left',
    render: (h, params) => {
      return h('div', [
        h('i-switch', {
          props: {
            type: 'primary',
            value: params.row.isEnabled
          },
          on: {
            'on-change': (value) => {
              bus.$emit('onSwitch', params.row.id, value, params.index)
            }
          }
        })
      ])
    }
  }, {
    title: '操作',
    align: 'left',
    render: (h, params) => {
      let editBtn = h('Button', {
        props: {
          size: 'small',
          type: 'primary'
        },
        class: 'mr',
        on: {
          click: () => {
            bus.$emit('onEdit', { id: params.row.id })
          }
        }
      }, '编辑')
      let delBtn = h('Button', {
        props: {
          size: 'small'
        },
        on: {
          click: () => {
            bus.$emit('onDelete', { id: params.row.id, index: params.index })
          }
        }
      }, '删除')
      return h('div', [editBtn, delBtn])
    }
  }],
  data: []
}
export default data